1 00:00:00,290 --> 00:00:04,160 All right, let's do a little testing to see if we're actually buying our properties and saving them. 2 00:00:04,160 --> 00:00:09,020 And I'm going to do this in Roblox studio and I'm going to use the test server with two players. 3 00:00:09,050 --> 00:00:10,920 See what happens when somebody leaves. 4 00:00:10,940 --> 00:00:14,000 First thing I'm going to do, though, is put some printouts in. 5 00:00:14,000 --> 00:00:21,470 I'm going to go to server script service game manager, and if you go down to the bottom. 6 00:00:22,450 --> 00:00:24,790 Player added event gets fired. 7 00:00:24,790 --> 00:00:27,370 We add our board, we initialize our player data. 8 00:00:27,400 --> 00:00:28,330 Let's look at that. 9 00:00:28,330 --> 00:00:29,560 I'm going to right click. 10 00:00:29,710 --> 00:00:31,480 I'm going to go to Declaration. 11 00:00:31,480 --> 00:00:32,500 It's just above. 12 00:00:32,530 --> 00:00:33,790 You could have scrolled up. 13 00:00:33,970 --> 00:00:39,550 I am going to clear out any data that I might have because I did run the game a few times. 14 00:00:39,850 --> 00:00:40,810 There we go. 15 00:00:40,810 --> 00:00:46,930 Now, when you do that, you're going to get a warning in the output window when you play the game because 16 00:00:46,930 --> 00:00:53,620 this async set async, which clears the data, fires very quickly. 17 00:00:53,650 --> 00:01:00,160 Well, this one fires very quickly after that other one saving data, you're going to get a build up 18 00:01:00,160 --> 00:01:01,240 of two calls. 19 00:01:01,240 --> 00:01:02,320 It'll be fine. 20 00:01:02,320 --> 00:01:02,800 Right. 21 00:01:02,800 --> 00:01:05,380 But it's just warning you saying, hey, it's too quick. 22 00:01:06,420 --> 00:01:06,600 All right. 23 00:01:06,600 --> 00:01:07,890 But that's going to be okay for us. 24 00:01:07,890 --> 00:01:08,940 We're not going to have to worry about that. 25 00:01:08,940 --> 00:01:12,420 And we're going to we're going to re comment this when we're done. 26 00:01:12,660 --> 00:01:12,960 All right. 27 00:01:12,960 --> 00:01:17,160 So here, if we get property, let's go ahead and print that out. 28 00:01:17,280 --> 00:01:17,560 Right. 29 00:01:17,580 --> 00:01:23,610 We want to make sure that when we come back, the second time that property persists. 30 00:01:23,610 --> 00:01:27,960 So maybe let's just take a look at the data itself. 31 00:01:27,960 --> 00:01:32,820 So we'll say data and I'll put a number here. 32 00:01:32,820 --> 00:01:36,240 I'll put one because this is the initialization. 33 00:01:36,840 --> 00:01:38,670 All right, what else are we going to do? 34 00:01:38,910 --> 00:01:41,130 Update player info. 35 00:01:41,160 --> 00:01:42,540 That's fine. 36 00:01:42,930 --> 00:01:46,890 Let's take a look at our saving player data. 37 00:01:46,890 --> 00:01:52,470 That's going to happen every ten seconds and our save loop. 38 00:01:52,470 --> 00:01:54,660 Let's see what's being saved off. 39 00:01:54,660 --> 00:01:56,280 We have our points here. 40 00:01:56,280 --> 00:01:58,560 We should have our property. 41 00:02:00,000 --> 00:02:03,960 Let's do another print and this is going to be two. 42 00:02:04,710 --> 00:02:09,220 And I'll just say data equals data. 43 00:02:10,130 --> 00:02:12,500 And I want one more. 44 00:02:14,060 --> 00:02:17,050 How about when I buy my property? 45 00:02:17,060 --> 00:02:17,540 Right. 46 00:02:17,540 --> 00:02:20,330 So I have my buy script under my lots. 47 00:02:20,980 --> 00:02:22,690 There's my by script. 48 00:02:23,890 --> 00:02:25,060 Right here. 49 00:02:25,450 --> 00:02:28,900 We're going to see if this gets cleared out when we leave. 50 00:02:28,900 --> 00:02:30,700 So we don't need a print statement here. 51 00:02:30,880 --> 00:02:37,690 We actually don't need a print statement here because we're going to see the name on the sign. 52 00:02:37,690 --> 00:02:40,270 So I think the two print statements are good. 53 00:02:40,270 --> 00:02:42,490 Let's go ahead and play our game. 54 00:02:43,060 --> 00:02:44,440 Hit the play button. 55 00:02:46,190 --> 00:02:47,780 See if we can buy a lot. 56 00:02:48,620 --> 00:02:49,120 All right. 57 00:02:49,130 --> 00:02:50,900 Let's take a look at our output window. 58 00:02:52,080 --> 00:02:56,850 And there is the warning for the data store request happening too quickly. 59 00:02:56,880 --> 00:03:00,000 We did two sinks in a row very, very rapidly. 60 00:03:01,120 --> 00:03:02,070 But it's fine. 61 00:03:02,080 --> 00:03:02,880 It cleared it out. 62 00:03:02,890 --> 00:03:04,430 See, we got 10,000 points. 63 00:03:04,450 --> 00:03:05,830 I'm going to buy my property. 64 00:03:08,910 --> 00:03:09,900 Nice. 65 00:03:09,900 --> 00:03:11,460 Simtek Nitro. 66 00:03:11,490 --> 00:03:13,770 I can't bring the prompt back up. 67 00:03:13,770 --> 00:03:14,790 That's good. 68 00:03:15,090 --> 00:03:26,460 And then Data two has our points in there, which is down to 5000 and has a property section with a 69 00:03:26,460 --> 00:03:30,270 has lot key value pair has lot equals. 70 00:03:30,270 --> 00:03:30,930 True. 71 00:03:31,230 --> 00:03:32,150 Nice. 72 00:03:32,160 --> 00:03:33,620 Now we're going to leave. 73 00:03:33,630 --> 00:03:35,850 Let's go ahead and stop the game. 74 00:03:37,790 --> 00:03:38,690 Nice. 75 00:03:39,020 --> 00:03:43,760 Let's close this and we've got to go back to our game manager. 76 00:03:44,500 --> 00:03:50,620 And we have to make sure we comment this out or we're going to wipe out everything we just did. 77 00:03:51,970 --> 00:03:54,280 Let's play it again and see if we got a lot. 78 00:03:58,690 --> 00:04:00,460 View output window. 79 00:04:01,390 --> 00:04:02,680 No warning. 80 00:04:02,680 --> 00:04:03,190 Let's see. 81 00:04:03,190 --> 00:04:05,530 That was the data coming in the initialization. 82 00:04:05,770 --> 00:04:07,480 We have a lot here. 83 00:04:07,510 --> 00:04:08,110 Yup. 84 00:04:08,110 --> 00:04:08,600 Has a lot. 85 00:04:08,620 --> 00:04:09,610 Equals true. 86 00:04:11,500 --> 00:04:14,920 And this says Simtek Nitro one. 87 00:04:14,920 --> 00:04:15,530 Yeah. 88 00:04:15,550 --> 00:04:16,240 All right. 89 00:04:16,270 --> 00:04:21,760 Now let's try it in our test manager, our test studio. 90 00:04:23,340 --> 00:04:24,330 Test server. 91 00:04:24,360 --> 00:04:25,410 That's the word I was looking for. 92 00:04:25,410 --> 00:04:26,400 Test server. 93 00:04:26,640 --> 00:04:26,780 All right. 94 00:04:26,790 --> 00:04:28,180 I'm going to close this. 95 00:04:28,200 --> 00:04:30,310 I'm going to start this test server up. 96 00:04:30,330 --> 00:04:30,790 Boom. 97 00:04:30,870 --> 00:04:31,820 Two players. 98 00:04:31,830 --> 00:04:35,850 I'm going to pause the video because it takes a while to start up and we're going to take a look at 99 00:04:35,850 --> 00:04:37,770 what happens when there's two people in the game. 100 00:04:37,770 --> 00:04:45,540 Now, we don't have to worry about the players owning these properties because the user ID is like negative 101 00:04:45,540 --> 00:04:46,830 one and negative two. 102 00:04:46,860 --> 00:04:50,610 If you're using the test server, it's not going to be your regular user ID. 103 00:04:54,080 --> 00:04:55,840 All right, so we got our players in here. 104 00:04:55,850 --> 00:04:56,570 Who am I? 105 00:04:57,050 --> 00:04:57,350 I am. 106 00:04:57,350 --> 00:05:01,310 PLAYER one Let's go over here by a lot. 107 00:05:01,400 --> 00:05:05,210 Notice that I don't own a lot because I am not. 108 00:05:05,240 --> 00:05:08,300 I'm not Simtek Nitro one I'm Player one. 109 00:05:10,760 --> 00:05:12,920 All right, Player one owns the lot. 110 00:05:12,950 --> 00:05:15,020 Let's see if player two goes to buy the lot. 111 00:05:15,050 --> 00:05:16,340 If anything happens. 112 00:05:18,920 --> 00:05:19,730 Nothin. 113 00:05:20,000 --> 00:05:21,380 He can't get it. 114 00:05:21,410 --> 00:05:26,270 What happens when player one leaves the game? 115 00:05:28,760 --> 00:05:29,780 Leave. 116 00:05:31,260 --> 00:05:33,220 I look at that for sale now. 117 00:05:33,240 --> 00:05:35,070 Can we buy this? 118 00:05:35,520 --> 00:05:36,710 We can't. 119 00:05:36,720 --> 00:05:37,650 Oh, yeah, we can. 120 00:05:37,680 --> 00:05:38,530 Oh, good. 121 00:05:38,550 --> 00:05:40,020 I was worried we had an error. 122 00:05:42,010 --> 00:05:42,700 Nice. 123 00:05:42,700 --> 00:05:44,590 Now we both own a property. 124 00:05:44,590 --> 00:05:48,640 I can't play this again or I'll get an error because I only have one lot. 125 00:05:48,670 --> 00:05:53,350 Remember, you have to have as many lots as players who can play the game, but this is fine for testing. 126 00:05:53,350 --> 00:05:57,070 We still have to do our beam and I think I'm going to put a little house on here. 127 00:05:57,070 --> 00:06:01,240 You could buy with like three different sizes, just so you know how to do that.